package com.esri.core.ags;

import com.esri.core.geometry.Envelope;
import com.esri.core.geometry.GeometryEngine;
import com.esri.core.geometry.MapGeometry;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.internal.util.d;
import com.esri.core.map.EditorTrackingInfo;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class FeatureServiceInfo implements Serializable {
    private static final long serialVersionUID = 1;
    String a;
    String b;
    String c;
    List<LayerServiceInfo> d;
    List<Table> e;
    SpatialReference f;
    Envelope g;
    SpatialReference h;
    MapGeometry i;
    String j;
    String k;
    FeatureServiceCapabilities l;
    int m;
    boolean n = false;
    private String o;
    private boolean p;
    private boolean q;
    private String r;
    private boolean s;
    private boolean t;
    private double u;
    private boolean v;
    private SyncCapabilities w;
    private EditorTrackingInfo x;

    FeatureServiceInfo(String str) {
        this.k = str;
    }

    public String getServiceDescription() {
        return this.a;
    }

    public String getDescription() {
        return this.b;
    }

    public String getCopyrightText() {
        return this.c;
    }

    public int[] getLayerIds() {
        List<LayerServiceInfo> list = this.d;
        int i = 0;
        if (list == null) {
            return new int[0];
        }
        int[] iArr = new int[list.size()];
        for (LayerServiceInfo layerServiceInfo : this.d) {
            iArr[i] = layerServiceInfo.getId();
            i++;
        }
        return iArr;
    }

    public List<LayerServiceInfo> getFeatureServiceLayerInfos() {
        return this.d;
    }

    public List<Table> getTables() {
        return this.e;
    }

    public int[] getTableIds() {
        List<Table> list = this.e;
        int i = 0;
        if (list == null) {
            return new int[0];
        }
        int[] iArr = new int[list.size()];
        for (Table table : this.e) {
            iArr[i] = table.getId();
            i++;
        }
        return iArr;
    }

    public SpatialReference getSpatialReference() {
        return this.f;
    }

    public Envelope getInitialExtent() {
        Envelope envelope = this.g;
        if (envelope == null || envelope.isEmpty()) {
            return envelope;
        }
        SpatialReference spatialReference = this.f;
        if (spatialReference == null) {
            return (this.i.getSpatialReference() == null || this.h == null || d.a(this.i.getSpatialReference(), this.h)) ? envelope : (Envelope) GeometryEngine.project(this.g, this.h, this.i.getSpatialReference());
        }
        SpatialReference spatialReference2 = this.h;
        return (spatialReference2 == null || d.a(spatialReference, spatialReference2)) ? envelope : (Envelope) GeometryEngine.project(this.g, this.h, this.f);
    }

    public Envelope getFullExtent() {
        MapGeometry mapGeometry = this.i;
        if (mapGeometry == null) {
            return null;
        }
        return (Envelope) mapGeometry.getGeometry();
    }

    public SpatialReference getInitialExtentSpatialReference() {
        SpatialReference spatialReference = this.h;
        return spatialReference == null ? this.f : spatialReference;
    }

    public String getUnits() {
        return this.j;
    }

    public String getUrl() {
        return this.k;
    }

    public boolean hasVersionedData() {
        return this.n;
    }

    public FeatureServiceCapabilities getCapabilities() {
        return this.l;
    }

    public String getVersion() {
        return this.o;
    }

    public int getMaxRecordCount() {
        return this.m;
    }

    public boolean isDisconnectedEditingSupported() {
        return this.p;
    }

    public boolean hasStaticData() {
        return this.q;
    }

    public String getSupportedQueryFormats() {
        return this.r;
    }

    public boolean isSyncEnabled() {
        return this.t;
    }

    public double getDefaultZ() {
        return this.u;
    }

    public boolean isZDefaultEnabled() {
        return this.v;
    }

    public SyncCapabilities getSyncCapabilities() {
        return this.w;
    }

    public EditorTrackingInfo getEditorTrackingInfo() {
        return this.x;
    }

    public boolean isAllowGeometryUpdates() {
        return this.s;
    }

    public static FeatureServiceInfo fromJson(JsonParser jsonParser, String str) throws Exception {
        if (jsonParser.getCurrentToken() != JsonToken.START_OBJECT) {
            return null;
        }
        FeatureServiceInfo featureServiceInfo = new FeatureServiceInfo(str);
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if ("currentVersion".equals(currentName)) {
                featureServiceInfo.o = jsonParser.getText();
            } else if ("serviceDescription".equals(currentName)) {
                featureServiceInfo.a = jsonParser.getText();
            } else if ("description".equals(currentName)) {
                featureServiceInfo.b = jsonParser.getText();
            } else if ("copyrightText".equals(currentName)) {
                featureServiceInfo.c = jsonParser.getText();
            } else if ("spatialReference".equals(currentName)) {
                featureServiceInfo.f = SpatialReference.fromJson(jsonParser);
            } else if ("units".equals(currentName)) {
                featureServiceInfo.j = jsonParser.getText();
            } else if ("supportedQueryFormats".equals(currentName)) {
                featureServiceInfo.r = jsonParser.getText();
            } else if ("fullExtent".equals(currentName)) {
                featureServiceInfo.i = d.e(jsonParser);
            } else if ("initialExtent".equals(currentName)) {
                MapGeometry e = d.e(jsonParser);
                if (e != null) {
                    featureServiceInfo.g = (Envelope) e.getGeometry();
                    featureServiceInfo.h = e.getSpatialReference();
                }
            } else if ("layers".equals(currentName)) {
                if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
                    featureServiceInfo.d = new ArrayList();
                    while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                        featureServiceInfo.d.add(LayerServiceInfo.fromJson(jsonParser));
                    }
                }
            } else if ("tables".equals(currentName)) {
                if (jsonParser.getCurrentToken() == JsonToken.START_ARRAY) {
                    featureServiceInfo.e = new ArrayList();
                    while (jsonParser.nextToken() != JsonToken.END_ARRAY) {
                        featureServiceInfo.e.add(Table.fromJson(jsonParser));
                    }
                }
            } else if ("capabilities".equals(currentName)) {
                featureServiceInfo.l = new FeatureServiceCapabilities(jsonParser.getText());
            } else if ("maxRecordCount".equals(currentName)) {
                featureServiceInfo.m = jsonParser.getIntValue();
            } else if ("supportsDisconnectedEditing".equals(currentName)) {
                featureServiceInfo.p = jsonParser.getBooleanValue();
            } else if ("hasVersionedData".equals(currentName)) {
                featureServiceInfo.n = jsonParser.getBooleanValue();
            } else if ("hasStaticData".equals(currentName)) {
                featureServiceInfo.q = jsonParser.getBooleanValue();
            } else if ("allowGeometryUpdates".equals(currentName)) {
                featureServiceInfo.s = jsonParser.getBooleanValue();
            } else if ("syncEnabled".equals(currentName)) {
                featureServiceInfo.t = jsonParser.getBooleanValue();
            } else if ("zDefault".equals(currentName)) {
                featureServiceInfo.u = jsonParser.getDoubleValue();
            } else if ("enableZDefaults".equals(currentName)) {
                featureServiceInfo.v = jsonParser.getBooleanValue();
            } else if ("syncCapabilities".equals(currentName)) {
                featureServiceInfo.w = SyncCapabilities.fromJson(jsonParser);
            } else if ("editorTrackingInfo".equals(currentName)) {
                featureServiceInfo.x = EditorTrackingInfo.fromJson(jsonParser);
            } else {
                jsonParser.skipChildren();
            }
        }
        return featureServiceInfo;
    }

    public int hashCode() {
        int i = ((this.s ? 1231 : 1237) + 31) * 31;
        FeatureServiceCapabilities featureServiceCapabilities = this.l;
        int hashCode = (i + (featureServiceCapabilities == null ? 0 : featureServiceCapabilities.hashCode())) * 31;
        String str = this.c;
        int hashCode2 = str == null ? 0 : str.hashCode();
        long doubleToLongBits = Double.doubleToLongBits(this.u);
        int i2 = (((hashCode + hashCode2) * 31) + ((int) (doubleToLongBits ^ (doubleToLongBits >>> 32)))) * 31;
        String str2 = this.b;
        int hashCode3 = (((i2 + (str2 == null ? 0 : str2.hashCode())) * 31) + (this.p ? 1231 : 1237)) * 31;
        EditorTrackingInfo editorTrackingInfo = this.x;
        int hashCode4 = (hashCode3 + (editorTrackingInfo == null ? 0 : editorTrackingInfo.hashCode())) * 31;
        MapGeometry mapGeometry = this.i;
        int hashCode5 = (((((hashCode4 + (mapGeometry == null ? 0 : mapGeometry.hashCode())) * 31) + (this.q ? 1231 : 1237)) * 31) + (this.n ? 1231 : 1237)) * 31;
        Envelope envelope = this.g;
        int hashCode6 = (hashCode5 + (envelope == null ? 0 : envelope.hashCode())) * 31;
        SpatialReference spatialReference = this.h;
        int hashCode7 = (((hashCode6 + (spatialReference == null ? 0 : spatialReference.hashCode())) * 31) + (this.v ? 1231 : 1237)) * 31;
        List<LayerServiceInfo> list = this.d;
        int hashCode8 = (((hashCode7 + (list == null ? 0 : list.hashCode())) * 31) + this.m) * 31;
        String str3 = this.a;
        int hashCode9 = (hashCode8 + (str3 == null ? 0 : str3.hashCode())) * 31;
        SpatialReference spatialReference2 = this.f;
        int hashCode10 = (hashCode9 + (spatialReference2 == null ? 0 : spatialReference2.hashCode())) * 31;
        String str4 = this.r;
        int hashCode11 = (hashCode10 + (str4 == null ? 0 : str4.hashCode())) * 31;
        SyncCapabilities syncCapabilities = this.w;
        int hashCode12 = (((hashCode11 + (syncCapabilities == null ? 0 : syncCapabilities.hashCode())) * 31) + (this.t ? 1231 : 1237)) * 31;
        List<Table> list2 = this.e;
        int hashCode13 = (hashCode12 + (list2 == null ? 0 : list2.hashCode())) * 31;
        String str5 = this.j;
        int hashCode14 = (hashCode13 + (str5 == null ? 0 : str5.hashCode())) * 31;
        String str6 = this.k;
        int hashCode15 = (hashCode14 + (str6 == null ? 0 : str6.hashCode())) * 31;
        String str7 = this.o;
        return hashCode15 + (str7 != null ? str7.hashCode() : 0);
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            FeatureServiceInfo featureServiceInfo = (FeatureServiceInfo) obj;
            if (this.s != featureServiceInfo.s) {
                return false;
            }
            FeatureServiceCapabilities featureServiceCapabilities = this.l;
            if (featureServiceCapabilities == null) {
                if (featureServiceInfo.l != null) {
                    return false;
                }
            } else if (!featureServiceCapabilities.equals(featureServiceInfo.l)) {
                return false;
            }
            String str = this.c;
            if (str == null) {
                if (featureServiceInfo.c != null) {
                    return false;
                }
            } else if (!str.equals(featureServiceInfo.c)) {
                return false;
            }
            if (Double.doubleToLongBits(this.u) != Double.doubleToLongBits(featureServiceInfo.u)) {
                return false;
            }
            String str2 = this.b;
            if (str2 == null) {
                if (featureServiceInfo.b != null) {
                    return false;
                }
            } else if (!str2.equals(featureServiceInfo.b)) {
                return false;
            }
            if (this.p != featureServiceInfo.p) {
                return false;
            }
            EditorTrackingInfo editorTrackingInfo = this.x;
            if (editorTrackingInfo == null) {
                if (featureServiceInfo.x != null) {
                    return false;
                }
            } else if (!editorTrackingInfo.equals(featureServiceInfo.x)) {
                return false;
            }
            MapGeometry mapGeometry = this.i;
            if (mapGeometry == null) {
                if (featureServiceInfo.i != null) {
                    return false;
                }
            } else if (!mapGeometry.equals(featureServiceInfo.i)) {
                return false;
            }
            if (this.q == featureServiceInfo.q && this.n == featureServiceInfo.n) {
                Envelope envelope = this.g;
                if (envelope == null) {
                    if (featureServiceInfo.g != null) {
                        return false;
                    }
                } else if (!envelope.equals(featureServiceInfo.g)) {
                    return false;
                }
                SpatialReference spatialReference = this.h;
                if (spatialReference == null) {
                    if (featureServiceInfo.h != null) {
                        return false;
                    }
                } else if (!spatialReference.equals(featureServiceInfo.h)) {
                    return false;
                }
                if (this.v != featureServiceInfo.v) {
                    return false;
                }
                List<LayerServiceInfo> list = this.d;
                if (list == null) {
                    if (featureServiceInfo.d != null) {
                        return false;
                    }
                } else if (!list.equals(featureServiceInfo.d)) {
                    return false;
                }
                if (this.m != featureServiceInfo.m) {
                    return false;
                }
                String str3 = this.a;
                if (str3 == null) {
                    if (featureServiceInfo.a != null) {
                        return false;
                    }
                } else if (!str3.equals(featureServiceInfo.a)) {
                    return false;
                }
                SpatialReference spatialReference2 = this.f;
                if (spatialReference2 == null) {
                    if (featureServiceInfo.f != null) {
                        return false;
                    }
                } else if (!spatialReference2.equals(featureServiceInfo.f)) {
                    return false;
                }
                String str4 = this.r;
                if (str4 == null) {
                    if (featureServiceInfo.r != null) {
                        return false;
                    }
                } else if (!str4.equals(featureServiceInfo.r)) {
                    return false;
                }
                SyncCapabilities syncCapabilities = this.w;
                if (syncCapabilities == null) {
                    if (featureServiceInfo.w != null) {
                        return false;
                    }
                } else if (!syncCapabilities.equals(featureServiceInfo.w)) {
                    return false;
                }
                if (this.t != featureServiceInfo.t) {
                    return false;
                }
                List<Table> list2 = this.e;
                if (list2 == null) {
                    if (featureServiceInfo.e != null) {
                        return false;
                    }
                } else if (!list2.equals(featureServiceInfo.e)) {
                    return false;
                }
                String str5 = this.j;
                if (str5 == null) {
                    if (featureServiceInfo.j != null) {
                        return false;
                    }
                } else if (!str5.equals(featureServiceInfo.j)) {
                    return false;
                }
                String str6 = this.k;
                if (str6 == null) {
                    if (featureServiceInfo.k != null) {
                        return false;
                    }
                } else if (!str6.equals(featureServiceInfo.k)) {
                    return false;
                }
                String str7 = this.o;
                if (str7 == null) {
                    if (featureServiceInfo.o != null) {
                        return false;
                    }
                } else if (!str7.equals(featureServiceInfo.o)) {
                    return false;
                }
                return true;
            }
            return false;
        }
        return false;
    }

    public String toString() {
        return "FeatureServer [serviceDescription=" + this.a + ", description=" + this.b + ", copyrightText=" + this.c + ", units=" + this.j + ", url=" + this.k + ", capabilities=" + this.l + ", maxRecords=" + this.m + ", hasVersionedData=" + this.n + ", version=" + this.o + ", disconnectedEditingSupported=" + this.p + ", hasStaticData=" + this.q + ", supportedQueryFormats=" + this.r + ", allowGeometryUpdates=" + this.s + ", syncEnabled=" + this.t + ", defaultZ=" + this.u + ", isZDefaultEnabled=" + this.v + ", syncCapabilities=" + this.w + ", editorTrackingInfo=" + this.x + "]";
    }
}
